package handler;

import com.lmax.disruptor.RingBuffer;

public class ProducerHandler<T>{

    private  final RingBuffer<T> ringBuffer;

    public ProducerHandler(RingBuffer<T> ringBuffer) {
        this.ringBuffer = ringBuffer;
    }

    public void onData(T newT){
        long next = ringBuffer.next();
        try {
            T t = ringBuffer.get(next);
            t = newT;
        }finally {
            ringBuffer.publish(next);
        }

    }
}
